'use strict';
angular.module('invoice.receiveYSZKQueryList', [])
	.controller('receiveYSZKQueryListCtrl'
			,['$rootScope', '$scope', 'BizData'
			   , f])
    function f($rootScope, $scope, BizData) {

		

		var Model = this;
		
		var options = {};
		options.container = Model;
		options.concept = 'AccountInvoice';
		options.name = 'dataMaster';
		options.url = $rootScope.path;
		options.httpUrl = $rootScope.getServiceName();
		options.reader = '/invoice/accountInvoice/query';
		options.writer = '';
		options.deleter = '';
		options.idColumnDefine = "fID";
		options.idColumnName = "fID";
		options.defCols = {fID:{name:"fID",type:"String",label:""},orderType:{name:"orderType",type:"String",label:""},orderTypeLabel:{name:"orderTypeLabel",type:"String",label:""},systemCode:{name:"systemCode",type:"String",label:""},billType:{name:"billType",type:"String",label:""},billTypeName:{name:"billTypeName",type:"String",label:""},orderDate:{name:"orderDate",type:"Date",label:""},state:{name:"state",type:"String",label:""},status:{name:"status",type:"String",label:""},audit:{name:"audit",type:"String",label:""},flowType:{name:"flowType",type:"Integer",label:""},revOpay:{name:"revOpay",type:"String",label:""},direction:{name:"direction",type:"Integer",label:""},confirmDate:{name:"confirmDate",type:"Date",label:""},origin:{name:"origin",type:"String",label:""},originName:{name:"originName",type:"String",label:""},originNo:{name:"originNo",type:"String",label:""},periodStatus:{name:"periodStatus",type:"String",label:""},periodNo:{name:"periodNo",type:"String",label:""},accountInvoiceNo:{name:"accountInvoiceNo",type:"String",label:""},invoiceCategory:{name:"invoiceCategory",type:"String",label:""},invoiceCategoryLabel:{name:"invoiceCategoryLabel",type:"String",label:""},invoiceCode:{name:"invoiceCode",type:"String",label:""},invoiceDate:{name:"invoiceDate",type:"Date",label:""},dealObject:{name:"dealObject",type:"String",label:""},dealObjectLabel:{name:"dealObjectLabel",type:"String",label:""},customerID:{name:"customerID",type:"String",label:""},customerNo:{name:"customerNo",type:"String",label:""},shortName:{name:"shortName",type:"String",label:""},customerName:{name:"customerName",type:"String",label:""},taxType:{name:"taxType",type:"Integer",label:""},taxTypeLabel:{name:"taxTypeLabel",type:"String",label:""},taxRate:{name:"taxRate",type:"Decimal",label:""},fPhone:{name:"fPhone",type:"String",label:""},taxNo:{name:"taxNo",type:"String",label:""},accountBank:{name:"accountBank",type:"String",label:""},accountNo:{name:"accountNo",type:"String",label:""},captionID:{name:"captionID",type:"String",label:""},captionNo:{name:"captionNo",type:"String",label:""},captionName:{name:"captionName",type:"String",label:""},captionFullName:{name:"captionFullName",type:"String",label:""},itemAmount:{name:"itemAmount",type:"Decimal",label:""},orderAmount:{name:"orderAmount",type:"Decimal",label:""},orderAmountOld:{name:"orderAmountOld",type:"Decimal",label:""},orderAmountTax:{name:"orderAmountTax",type:"Decimal",label:""},orderAmountTotal:{name:"orderAmountTotal",type:"Decimal",label:""},orderAmountCleared:{name:"orderAmountCleared",type:"Decimal",label:""},pendingAmount:{name:"pendingAmount",type:"Decimal",label:""},isMember:{name:"isMember",type:"Integer",label:""},memberNo:{name:"memberNo",type:"String",label:""},isHaveCoupon:{name:"isHaveCoupon",type:"Integer",label:""},discountCash:{name:"discountCash",type:"Decimal",label:""},depositRate:{name:"depositRate",type:"Decimal",label:""},accountAmountOld:{name:"accountAmountOld",type:"Decimal",label:""},accountAmountTax:{name:"accountAmountTax",type:"Decimal",label:""},accountAmountTotal:{name:"accountAmountTotal",type:"Decimal",label:""},discountRate:{name:"discountRate",type:"Decimal",label:""},fMasterID:{name:"fMasterID",type:"String",label:""},paymentTerm:{name:"paymentTerm",type:"String",label:""},paymentTermLabel:{name:"paymentTermLabel",type:"String",label:""},predictStart:{name:"predictStart",type:"Date",label:""},predictEnd:{name:"predictEnd",type:"Date",label:""},cashSettle:{name:"cashSettle",type:"Integer",label:""},next:{name:"next",type:"String",label:""},nextName:{name:"nextName",type:"String",label:""},nextNo:{name:"nextNo",type:"String",label:""},settleCategory:{name:"settleCategory",type:"String",label:""},settleCategoryLabel:{name:"settleCategoryLabel",type:"String",label:""},orderNo:{name:"orderNo",type:"String",label:""},projectNo:{name:"projectNo",type:"String",label:""},serialNumber:{name:"serialNumber",type:"String",label:""},resultStatus:{name:"resultStatus",type:"String",label:""},handling:{name:"handling",type:"String",label:""},handlingLabel:{name:"handlingLabel",type:"String",label:""},clearDatetime:{name:"clearDatetime",type:"Datetime",label:""},detailsCount:{name:"detailsCount",type:"Integer",label:""},detailsCountState:{name:"detailsCountState",type:"Integer",label:""},maxDetailNo:{name:"maxDetailNo",type:"Integer",label:""},employeeNo:{name:"employeeNo",type:"String",label:""},employeeName:{name:"employeeName",type:"String",label:""},comments:{name:"comments",type:"String",label:""},cUsercode:{name:"cUsercode",type:"String",label:""},cUsername:{name:"cUsername",type:"String",label:""},cDatetime:{name:"cDatetime",type:"Datetime",label:""},tUsercode:{name:"tUsercode",type:"String",label:""},tUsername:{name:"tUsername",type:"String",label:""},tDatetime:{name:"tDatetime",type:"Datetime",label:""},eUsercode:{name:"eUsercode",type:"String",label:""},eUsername:{name:"eUsername",type:"String",label:""},eDatetime:{name:"eDatetime",type:"Datetime",label:""},userId:{name:"userId",type:"String",label:""},enterpriseNo:{name:"enterpriseNo",type:"String",label:""},enterpriseName:{name:"enterpriseName",type:"String",label:""},version:{name:"version",type:"Integer",label:""}};
		options.isTree = false;
		options.parentRelation = 'fParent';
		options.nodeKindRelation = 'nodeKind';
		options.nodeLevelRelation = 'nodeLevel';
		options.pathRelation = '';
//		options.master = {"data":"$scope.dataMaster","relation":"fMasterID"};
//		options.masterData = $scope.dataMaster;
//		options.slaveDatas = null;
		options.directDeleteMode = false;
		options.orderBy = 'cDatetime DESC';
		options.limit = 10;
		//聚合列
		options.aggregateColumns = {"orderAmountTotal*direction":{name:"sumAccountAmountTotal",type:"Decimal",label:""},"orderAmountCleared*direction":{name:"sumAccountAmountActual",type:"Decimal",label:""},"pendingAmount*direction":{name:"sumAccountAmountDiff",type:"Decimal",label:""}};

		Model.dataMaster = new BizData(options);

		//////////////////////////////////////////////
		
		
		
		////////////////////启动执行开始///////////////////////////////////////////////////

		//设置过滤条件
		Model.dataMaster.filter = "AccountInvoice.audit='confirm'"	
			+ " AND AccountInvoice.status='open'"
			+ " AND AccountInvoice.revOpay='O'"
			;

		//刷新数据
	    Model.dataMaster.refreshData();

		////////////////////启动执行结束///////////////////////////////////////////////////
	    
		Model.refresh = function(){
			Model.dataMaster.refreshData();
		}
		
	    return Model;
		
	}	
	
